
<?php echo $this->doctype(); ?>

<html lang="en">
    <head>
        <meta charset="utf-8">
        <?php echo $this->headTitle('FX ' . $this->translate('Trade Point'))->setSeparator(' - ')->setAutoEscape(false) ?>

        <?php
        echo $this->headMeta()
                ->appendName('viewport', 'width=device-width, initial-scale=1.0')
                ->appendHttpEquiv('X-UA-Compatible', 'IE=edge')
        ?>

        <!-- Le styles -->
        <?php
        echo $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/vnd.microsoft.icon', 'href' => $this->basePath() . '/img/favicon.ico'))
                ->appendStylesheet($this->basePath() . '/assets/css/bootstrap.min.css')
                ->appendStylesheet($this->basePath() . '/assets/css/font-awesome.min.css')

                ->appendStylesheet($this->basePath() . '/assets/css/chosen.css')
                ->appendStylesheet($this->basePath() . '/assets/css/jquery-ui-1.10.3.custom.min.css')
                ->appendStylesheet($this->basePath() . '/assets/css/jquery.gritter.css')
                ->appendStylesheet($this->basePath() . '/assets/css/ace-fonts.css')
                ->appendStylesheet($this->basePath() . '/assets/css/ace.min.css')
                
                
                ->appendStylesheet($this->basePath() . '/assets/css/ace-rtl.min.css')
                ->appendStylesheet($this->basePath() . '/assets/css/ace-skins.min.css')

        ;
        ?>

        <!-- Scripts -->
        <?php
        echo $this->headScript()
                ->appendFile($this->basePath() . '/js/jquery.min.1.10.1.js')
                ->appendFile($this->basePath() . '/assets/js/ace-extra.min.js')
        ;
        ?>

    </head>
    <body>
        <div class="navbar navbar-default" id="navbar">
            <script type="text/javascript">
                try {
                    ace.settings.check('navbar', 'fixed')
                } catch (e) {
                }
            </script>

            <div class="navbar-container" id="navbar-container">
                <div class="navbar-header pull-left">
                    <a href="#" class="navbar-brand">
                        <small>
                            <i class="icon-spinner icon-spin white bigger-125"></i>
                            Welcome to FX Trade Point
                        </small>
                    </a><!-- /.brand -->
                </div><!-- /.navbar-header -->

               
            </div><!-- /.container -->
        </div>

        <div class="main-container" id="main-container">
            

            <div class="main-container-inner">
                <div class="main-content">

                    

<div class="page-header">
    <h1>
        Registration Member
        <small>
            <i class="icon-double-angle-right"></i>
            Registration New Member
        </small>
    </h1>
</div>
                    
<?php 

if ($this->msg != "") {
    ?>
    <div class="alert alert-info">
        <button type="button" class="close" data-dismiss="alert">
            <i class="icon-remove"></i>
        </button>

        <strong>
            <i class="icon-ok"></i>
        </strong>

        <?php echo $this->msg; ?>, go to <a href="login">Login Page</a>
        <br />
    </div>
    <?php
}
if ($this->errmsg != "") {
    ?>
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">
            <i class="icon-remove"></i>
        </button>

        <strong>
            <i class="icon-remove"></i>

        </strong>

        <?php echo $this->errmsg; ?>
        <br />
    </div>
<?php
}
?>

    <div class="row">
        <div class="col-xs-11">
            <form id="formAdd" class="form-horizontal" role="form" action="" method="post" onsubmit="return submitForm()">
                <div class="col-sm-12">

                    

                    <div class="col-sm-6">
                    <h4>
                    <i class="icon-credit-card"></i>
                      FX Trade Point ID Details
                    </h4>
                        <br>
                        <div class="form-group">
                            <label class="col-sm-6" for="sponsorCode"> Sponsor ID </label>

                            <div class="col-sm-12">
                                <input type="text" id="sponsorCode" name="sponsorCode" placeholder="Sponsor ID" class="col-xs-8" value="<?php if (isset( $this->data['sponsorCode'] )) { echo $this->data['sponsorCode'];} ?>" required />
                                <span class="help-inline col-xs-4 col-sm-4">
                                    <span class="middle"><a href="javascript:void(0)" onclick="getSponsor()" id="getSp">Get Sponsor</a></span>
                                </span>

                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="sponsorName"> Sponsor Name </label>

                            <div class="col-sm-12">
                                <input type="text" id="sponsorName" name="sponsorName" placeholder="Sponsor Name" class="col-xs-8" value="<?php if (isset( $this->data['sponsorName'] )) { echo $this->data['sponsorName'];} ?>" required />
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="upperCode"> Upperlink ID </label>

                            <div class="col-sm-12">
                                <input type="text" id="upperCode" name="upperCode" placeholder="Upperlink ID" class="col-xs-8" value="<?php if (isset( $this->data['upperCode'] )) { echo $this->data['upperCode'];} ?>" required />
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="upperName"> Upperlink Name </label>

                            <div class="col-sm-12">
                                <input type="text" id="upperName" name="upperName" placeholder="Upperlink Name" class="col-xs-8" value="<?php if (isset( $this->data['upperName'] )) { echo $this->data['upperName'];} ?>" required />
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="pos"> Position </label>

                            <div class="col-sm-12">
                                <?php
                                $pos = $this->data["pos"];

                                if ($pos != ""){
                                    $readOnly = "disabled";
                                }
                                ?>
                                <select class="col-xs-8" id="slpos" name="slpos" <?php echo $readOnly;?>>
                                    <option value="1" <?php if ($pos == 1) echo "selected";?>>LEFT</option>
                                    <option value="2" <?php if ($pos == 2) echo "selected";?>>RIGHT</option>
                                </select>
                                <input type="hidden" id="pos" name="pos" value="<?php echo $pos;?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="password"> Password </label>

                            <div class="col-sm-12">
                                <input type="password" id="pass" name="pass" placeholder="Password" class="col-xs-8" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="name"> Confirm Password </label>

                            <div class="col-sm-12">
                                <input type="password" id="confPass" name="confPass" placeholder="Confirm Password" class="col-xs-8" required />
                            </div>
                        </div>

                    </div>

                    <div class="col-sm-6">
                        <h4>
                    <i class="icon-user"></i>
                      Personal Detail
                    </h4>
                        <br>
                        <div class="form-group">
                            <label class="col-sm-6" for="firstName"> First Name </label>

                                <div class="col-sm-12">
                                   <input type="text" id="firstName" name="firstName" placeholder="First Name" class="col-xs-8" value="<?php if (isset( $this->data['firstName'] )) { echo $this->data['firstName'];} ?>" required />
                                </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="lastName">Last Name</label>
                            <div class="col-sm-12">
                                <input type="text" id="lastName" name="lastName" placeholder="Last Name" class="col-xs-8" value="<?php if (isset( $this->data['lastName'] )) { echo $this->data['lastName'];} ?>" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="address"> Address </label>

                            <div class="col-sm-8">
                                <textarea id="address" name="address" class="autosize-transition form-control" placeholder="Address" required><?php if (isset( $this->data['address'] )) { echo $this->data['address'];} ?></textarea>
                            </div>
                        </div>
                                    <div class="form-group">
                            <label class="col-sm-6" for="city"> City </label>

                            <div class="col-sm-12">
                                <input type="text" id="city" name="city" placeholder="City" class="col-xs-8" value="<?php if (isset( $this->data['city'] )) { echo $this->data['city'];} ?>" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="name"> Country </label>

                            <div class="col-sm-12">
                                <select class="col-xs-8 chosen-select" id="country" name="country" data-placeholder="Choose a Country...">
                                    <option value="">&nbsp;</option>

                                    <?php
                                    for ($x=0; $x<count($this->countryList); $x++){
                                        echo "<option value='".$this->countryList[$x]["code"]."'>".$this->countryList[$x]["name"]."</option>\n";
                                    }
                                    ?>

                                    </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="mobile"> Mobile </label>

                            <div class="col-sm-12">
                                <input type="text" id="mobile" name="mobile" placeholder="Mobile" class="col-xs-8" value="<?php if (isset($this->data['mobile'])) { echo $this->data['mobile']; } ?>" required />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-6" for="email"> Email </label>

                            <div class="col-sm-12">
                                <input type="text" id="email" name="email" placeholder="Email" class="col-xs-8" value="<?php if (isset( $this->data['email'] )) { echo $this->data['email'];} ?>" required />
                            </div>
                        </div>

                        

                    </div>

                    <div class="col-sm-12 clearfix form-actions">
                            <div class="col-md-offset-3 col-md-9">
                                <label class="middle">
                                <input name="cbAgree" id="cbAgree" type="checkbox" class="ace" />
                                <span class="lbl"> I Accept The <a href="#">Terms and Conditions</a></span>
                                </label>

                            </div>
                            <br><br>
                            <div class="col-md-offset-3 col-md-9">
                                <button class="btn btn-success" type="submit">
                                    <i class="icon-ok bigger-110"></i>
                                    Submit
                                </button>

                                &nbsp; &nbsp; &nbsp;
                                <button class="btn" type="reset">
                                    <i class="icon-undo bigger-110"></i>
                                    Reset
                                </button>
                                <input type="hidden" id="sponsorId" name="sponsorId" value="<?php if (isset( $this->data['sponsorId'] )) { echo $this->data['sponsorId'];} ?>"/>
                                <input type="hidden" id="upperId" name="upperId" value="<?php if (isset( $this->data['upperId'] )) { echo $this->data['upperId'];} ?>"/>

                            </div>

                        </div>

                    <div class="col-sm-12 toolbar clearfix">
                    <div>
                        <a href="login" >
                            <i class="icon-arrow-left"></i>
                            Login
                        </a>
                        <br><br>
                    </div>
                </div>
            </div><!-- /span -->

                
            </form>
    </div>

</div>

</div><!-- /.page-content -->
                

            </div><!-- /.main-container-inner -->

            <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
                <i class="icon-double-angle-up icon-only bigger-110"></i>
            </a>
        </div><!-- /.main-container -->

        <!-- basic scripts -->

        <!--[if !IE]> -->

        <script type="text/javascript">
            window.jQuery || document.write("<script src='<?php echo $this->basePath()?>/assets/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
        </script>

        <!-- <![endif]-->

        <!--[if IE]>
<script type="text/javascript">
window.jQuery || document.write("<script src='assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

        <script type="text/javascript">
            if ("ontouchend" in document)
                document.write("<script src='<?php echo $this->basePath()?>/assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
        </script>
        <script src="<?php echo $this->basePath()?>/assets/js/bootstrap.min.js"></script>
        <script src="<?php echo $this->basePath()?>/assets/js/typeahead-bs2.min.js"></script>

        <!-- page specific plugin scripts -->

        <!--[if lte IE 8]>
          <script src="assets/js/excanvas.min.js"></script>
        <![endif]-->

          <script src="<?php echo $this->basePath()?>/assets/js/jquery-ui-1.10.3.custom.min.js"></script>
        <script src="<?php echo $this->basePath()?>/assets/js/jquery.ui.touch-punch.min.js"></script>
        <script src="<?php echo $this->basePath()?>/assets/js/jquery.slimscroll.min.js"></script>
        <script src="<?php echo $this->basePath()?>/assets/js/chosen.jquery.min.js"></script>
        <script src="<?php echo $this->basePath()?>/assets/js/jquery.autosize.min.js"></script>

        <!--
        <script src="assets/js/jquery.easy-pie-chart.min.js"></script>
        <script src="assets/js/jquery.sparkline.min.js"></script>
        <script src="assets/js/flot/jquery.flot.min.js"></script>
        <script src="assets/js/flot/jquery.flot.pie.min.js"></script>
        <script src="assets/js/flot/jquery.flot.resize.min.js"></script>

        -->



		<?php
                //if($identity->member_reff_id){
		?>
		
		<script src="<?php echo $this->basePath()?>/assets/js/jquery.validate.min.js"></script>
		<script src="<?php echo $this->basePath()?>/assets/js/additional-methods.min.js"></script>
		<script src="<?php echo $this->basePath()?>/assets/js/bootbox.min.js"></script>
                <script src="<?php echo $this->basePath()?>/assets/js/jquery.maskedinput.min.js"></script>
		<script src="<?php echo $this->basePath()?>/assets/js/select2.min.js"></script>
                <script src="<?php echo $this->basePath()?>/assets/js/jquery.gritter.min.js"></script>
                
                    
		<?php
		//}
		?>

		 <!-- ace scripts -->

        <script src="<?php echo $this->basePath()?>/assets/js/ace-elements.min.js"></script>
        <script src="<?php echo $this->basePath()?>/assets/js/ace.min.js"></script>
        <!-- inline scripts related to this page -->

        <script>
        jQuery(function($) {
            $('.chosen-select').chosen();
            

            $('#modal-form').on('shown.bs.modal', function() {
                $(this).find('.chosen-container').each(function() {
                    $(this).find('a:first-child').css('width', '210px');
                    $(this).find('.chosen-drop').css('width', '210px');
                    $(this).find('.chosen-search input').css('width', '200px');
                });
            });

            $('textarea[class*=autosize]').autosize({append: "\n"});
            
            
        });

        
        
        function submitForm(){

            var pass = $('#pass').val();
            var pass2 = $('#confPass').val();

            if (pass != pass2){
                bootbox.dialog({
                        message: "<span class='bigger-110'>Password do not match</span>",
                        buttons:
                        {
                                "button" :
                                 {
                                        "label" : "<i class='icon-ok'></i> Ok",
                                        "className" : "btn-sm btn-primary",
                                        //"callback": function() {
                                                //Example.show("great success");
                                        //}
                                }
                        }
                });

                return false;
            }

            if ($('#cbAgree').prop('checked') == false){
                bootbox.dialog({
                        message: "<span class='bigger-110'>You must accept the Terms and Conditions</span>",
                        buttons:
                        {
                                "button" :
                                 {
                                        "label" : "<i class='icon-ok'></i> Ok",
                                        "className" : "btn-sm btn-primary",
                                        //"callback": function() {
                                                //Example.show("great success");
                                        //}
                                }
                        }
                });
                return false;
            }


            return true;

        }

        function getSponsor(){

                document.getElementById("getSp").innerHTML = "Fetching...";

            $.ajax({
                type: 'GET',
                dataType: 'text',
                url: '<?php echo $this->url() ?>Index/getsponsor?spId=<?php echo $this->spId;?>',
                success: function(result){

                            if (result != ""){
                                var arrRes = result.split("#");
                                var arrSponsor = arrRes[0].split("|");
                                var arrParent = arrRes[1].split("|");
                                var pos = (arrParent[3] == 1) ? 2 : 1;

                                $('#sponsorId').val(arrSponsor[0]);
                                $('#sponsorCode').val(arrSponsor[1]);
                                $('#sponsorName').val(arrSponsor[2]);

                                $('#upperId').val(arrParent[0]);
                                $('#upperCode').val(arrParent[1]);
                                $('#upperName').val(arrParent[2]);
                                $('#pos').val(pos);
                       
                            }

                            document.getElementById("getSp").innerHTML = "Get Sponsor";
                            
                     }
                });
        }
        </script>

    </body>
</html>